/**
 * Name: Tile
 * @author Zhongtian Jiang
 * @version 1.0
 * 
 * This is a button represents a single grid
 */
import java.awt.Color;
import java.awt.Dimension;
import javax.swing.JButton;

/**
 * @author Master
 * @version $Revision: 1.0 $
 */
public class Tile extends JButton{
	
	/**
	 * Field WUSHI.
	 * (value is 50)
	 */
	private static final int WUSHI = 50;

	/**
	 * Field isoni.
	 */
	private boolean isoni;

	/**
     * constructor
     */
	
	public Tile(){
		
		isoni = false;
		setBackground(Color.yellow);
		setPreferredSize(new Dimension(WUSHI, WUSHI));
		
	}

	/**
     * this method changes the status of the current grid
     */
	
	public void changeStatus(){
		
		isoni=!isoni;
		if (isoni){
			this.setBackground(Color.blue);
		}
		else {
			this.setBackground(Color.yellow);
		}
		return;
		
	}

	/**
     * this method is used when the current grid is refered as a hint
     */
	
	public void shine(){
		
		this.setBackground(Color.red);
		
	}

	/**
     * this method changes the status of the current grid without display on the panel
     */
	
	public void changeStatusWithoutDisplay(){
		
		isoni=!isoni;
	
	}
	
	/**
     * this method returns if the light of the current grid is on or not
    
     * @return a boolean */
	
	public boolean isOn(){
		
		return isoni;
	
	}
}
